package com.colorful.insuranceproject.mine;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.widget.TextView;

import com.colorful.insuranceproject.R;
import com.colorful.insuranceproject.base.TitleActivity;
import com.colorful.insuranceproject.bean.CompanyInfo;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by handsome-Bob on 2017/8/21.
 * <p>
 * 公司信息
 */
public class CompanyInfoActivity extends TitleActivity {

    public static final String EXTRA_COMPANY_INFO = "extra_company_info";

    /**
     * 公司名称
     */
    @Bind(R.id.tv_company_name)
    TextView tvCompanyName;

    /**
     * 企业联系人
     */
    @Bind(R.id.tv_enterprise_contact)
    TextView tvEnterpriseContact;

    /**
     * 联系手机
     */
    @Bind(R.id.tv_contact_mobile)
    TextView tvContactMobile;

    /**
     * 企业账户
     */
    @Bind(R.id.tv_enterprise_account)
    TextView tvEnterpriseAccount;

    CompanyInfo ci;

    @Override
    protected int getContentView() {
        return R.layout.activity_company_info;
    }

    @Override
    protected void initViews() {
        ButterKnife.bind(this);
        setTitle(getString(R.string.company_info));
    }

    @Override
    protected void onViewInitialized() {
        if (ci != null) {
            tvCompanyName.setText(ci.getResultId());//公司名称
            tvEnterpriseContact.setText(ci.getResultName());//企业联系人
            tvContactMobile.setText(ci.getResultPhone());//联系手机
            tvEnterpriseAccount.setText(ci.getResultStatus() == 1 ? getString(R.string.enable) : getString(R.string.enablefalse));//企业账户
        }
    }

    @Override
    protected void onInitExtras(@NonNull Bundle bundle) {
        super.onInitExtras(bundle);
        ci = bundle.getParcelable(EXTRA_COMPANY_INFO);
    }

    @Override
    public void restoreInstanceOnCreateBefore(@NonNull Bundle savedInstance) {

    }

    @Override
    public void restoreInstanceOnCreateAfter(@NonNull Bundle savedInstance) {

    }
}
